import os
import pickle
import threading
import asyncio
from queue import Queue

import requests

import config
import lol
import tool
from mail import Mail163


async def hello():
    print("Hello world!")
    m = Mail163('coinsuper', 'Welcome to ', True)
    await m.login('rxcoxq8125735@163.com', 'fhw9973')
    print('Hello worldaa')


def strat(path):
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)
    tasks=[]
    for f in path:
        tasks.append(tool.async_login(Mail163('coinsuper', 'Welcome to ', True),f))
    loop.run_until_complete(asyncio.wait(tasks))
    loop.close()


def strat_msg(path):
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)
    tasks=[]
    for f in path:
        tasks.append(lol.coinsuper().async_send_msg(f))
    loop.run_until_complete(asyncio.wait(tasks))
    loop.close()




# f = open('./cookies_163.obj', 'wb')
# pickle.dump(config.cookies_163, f)
# loop.close()
#tool.TOOL.getProXY()
